package application.translators.impl;

import application.model.ApplianceModel;
import application.model.AppliancesModel;
import application.translators.Translator;
import mappings.Appliances;

import java.util.List;

public class AppliancesTranslator implements Translator<List<Appliances>, AppliancesModel>
{
    @Override
    public AppliancesModel translate(List<Appliances> input)
    {
        AppliancesModel appliancesModel = new AppliancesModel();

        for(Appliances appliance : input)
        {
            ApplianceModel applianceModel = new ApplianceModel();

            applianceModel.setId(appliance.getId());
            applianceModel.setName(appliance.getName());

            appliancesModel.addAppliance(applianceModel);
        }

        return appliancesModel;
    }
}
